<?php

class RemarksModel extends Model
{
    protected 	$_validate=array(
        array("content","getContent","备注内容不得少于5个字",0,'callback'),
    );
    protected $_auto = array (
        array('content','getContent',3,'callback'),
        array('lxtime','getTime',3,'callback')
    );


    public  function  getTime()
    {
        return date("Y-m-d H:i:s");
    }

    public  function  getContent()
    {
        $content = I("post.content");
        $content =$this->repl_wspace($content);

        if (strlen($content)>5)
        {
            return $content;
        } else
        {
            return false;
        }
    }

    /**
     * replace whitel space
     * @param $str
     * @return mixed
     */
    public  function  repl_wspace($str)
    {
        mb_internal_encoding('UTF-8');
        $str = str_replace(" ", "", $str);
        $str = str_replace("　", "", $str);
      //  $str= mb_ereg_replace('(　| )+$', '', $str);
        return $str;
    }
}

?>
